package com.info.zhiduoduo.admin.model.dto.account;

import java.math.BigDecimal;

import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;

@Data
@AllArgsConstructor
@NoArgsConstructor
@Accessors(chain = true)
public class QuarterBusinessGrossDto {

	@ApiModelProperty("当前年份")
	private int year;
	@ApiModelProperty("当前季度 1,2,3,4")
	private int quarter;
	@ApiModelProperty("季度项目总金额")
	private BigDecimal quarterTotalAmount;
	@ApiModelProperty("服务费")
	private BigDecimal serviceCharge;
	@ApiModelProperty("个税 ")
	private BigDecimal taxFee;
	@ApiModelProperty("增值税")
	private BigDecimal valueAddedTax;
	@ApiModelProperty("佣金")
	private BigDecimal brokerage;
	@ApiModelProperty("合计=服务费+个税+增值税")
	private BigDecimal sum;
	@ApiModelProperty("毛利=服务费-合伙人佣金")
	private BigDecimal gross;

	public static QuarterBusinessGrossDto of(int year, int quarter) {
		return new QuarterBusinessGrossDto(year, quarter, BigDecimal.ZERO, BigDecimal.ZERO, BigDecimal.ZERO, BigDecimal.ZERO, BigDecimal.ZERO,
				BigDecimal.ZERO, BigDecimal.ZERO);
	}

	public QuarterBusinessGrossDto add(QuarterBusinessGrossDto other) {
		this.quarterTotalAmount = this.quarterTotalAmount.add(other.quarterTotalAmount);
		this.serviceCharge =this.serviceCharge.add(other.serviceCharge);
		this.taxFee = this.taxFee.add(other.taxFee);
		this.valueAddedTax = this.valueAddedTax.add(other.valueAddedTax);
		this.brokerage = this.brokerage.add(other.brokerage);
		this.sum = this.sum.add(other.sum);
		this.gross = this.gross.add(other.gross);
		return this;
	}
}
